/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: Jet_Brains_Mono;
  src: url(//assets.aulence.com/font/JETBRAINSMONO-REGULAR.TTF);
}

body {
  font-family: Jet_Brains_Mono, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 导航栏样式 */
.navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.navbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.navbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
  font-weight: 600;
  transition: all 0.2s ease;
}

.navbar-brand:hover {
  transform: translateY(-1px);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
}

.logo {
  height: 48px;
  width: auto;
}

.brand-text {
  color: #1a1a1a;;
}

.brand-text .brand-name,
.brand-text .brand-slogan {
  line-height: 1.1;
  display: block;
}

.brand-text .brand-name {
  font-size: 25px;
  font-weight: 600;
  color: white;
}

.brand-text .brand-slogan {
  text-align: justify;
  text-align-last: justify;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.navbar-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 720px) {
  .navbar {
    padding: 1rem 20px;
  }
  .navbar .navbar-left  {
    display: none;
  }
  .navbar-center .navbar-nav {
    gap: 0.4rem;
  }
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-dropdown {
  position: relative;
  display: inline-block;
}

.user-info {
  display: flex;
  align-items: center;
  color: white;
  font-weight: 500;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-info:hover {
  background: rgba(255, 255, 255, 0.3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
  margin-right: 8px;
}

.nav-username {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 140px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.user-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

.logout-btn {
  color: #dc2626 !important;
}

.logout-btn:hover {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
}

.nav-link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.app {
  width: calc(100% - 24px);
  max-width: 1440px;
  min-width: 280px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

@media (max-width: 720px) {
  .app  {
    max-width: 100%;
    padding: 12px 0;
  }
  .app .app-header {
    padding: 20px 12px;
    border-radius: 0;
  }

  .app .word-list-container {
    padding: 12px;
    border-radius: 0;
  }
}

/* 头部样式 */
.app-header {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 20px auto 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #aba8af;
  font-size: 20px;
}

.search-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-between;
}

@media screen and (max-width: 720px) {
  .search-container {
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: flex-start;
  }

  .search-container .add-box {
    justify-content: flex-start;
  }
}

.search-box {
  display: flex;
  flex: 1;
}

.add-box {
  display: flex;
  justify-content: flex-end;
}

input[type="text"] {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 16px;
  outline: none;
}

button {
  padding: 10px 20px;
  background-color: #905af0;
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.add-box button {
  border-radius: 4px;
}

.clear-search-btn {
  border-radius: 4px;
  margin-left: 5px;
  background-color: #e74c3c;
}

.clear-search-btn:hover {
  background-color: #c0392b;
}

button:hover {
  background-color: #7a4dd6;
}

@media screen and (max-width: 720px) {
  .search-box input[type="text"]  {
    width: 108px;
  }
  .search-box button,
  .add-box button {
    padding: 6px 12px;
    font-size: 14px;
    white-space: nowrap;
  }
}

/* 单词列表样式 */
.word-list-container {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 筛选控制按钮 */
.filter-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 720px) {
  .filter-controls {
    display: block;
  }

  .filter-controls .filter-buttons {
    gap: 0.4rem;
    margin-bottom: 12px;
  }
  .filter-controls .filter-buttons .filter-btn {
    padding: 4px 8px;
  }
}

/* 单词统计信息 */
.word-count-statistics {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #495057;
  text-align: center;
  font-weight: 500;
}

@media (max-width: 720px) {
  .word-count-statistics {
    font-size: 13px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
}

.filter-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.manage-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 视图切换按钮 */
.switch-list-view {
  background: #8f59ef;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  height: 36px;
}

.switch-list-view:hover {
  background: #7c4ddb;
  transform: translateY(-1px);
}

.switch-list-view img {
  display: block;
}

.manage-btn {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.manage-btn:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.manage-actions {
  display: flex;
  gap: 0.5rem;
}

.manage-action-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.manage-action-btn.danger {
  background: #ef4444;
  color: white;
}

.manage-action-btn.danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.manage-action-btn:not(.danger) {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.manage-action-btn:not(.danger):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.filter-btn {
  padding: 8px 16px;
  background-color: #f8f5ff;
  color: #905af0;
  border: 2px solid #905af0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.filter-btn:hover {
  background-color: #e6d9ff;
}

.filter-btn.active {
  background-color: #905af0;
  color: white;
}

.filter-btn.active:hover {
  background-color: #7a4dd6;
}

/* 记忆状态开关 */
.memory-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch-label {
  font-size: 14px;
  color: #905af0;
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f8f5ff;
  border: 2px solid #905af0;
  border-radius: 17px;
  transition: .3s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 50px;
  left: 2px;
  bottom: 2px;
  background-color: #905af0;
  border-radius: 13px;
  transition: .3s;
  z-index: 2;
}

input:checked + .slider:before {
  transform: translateX(64px);
}

.switch-text {
  font-size: 12px;
  font-weight: 500;
  z-index: 1;
  position: relative;
  transition: color 0.3s;
}

.switch-text.left {
  color: #fff;
}

.switch-text.right {
  color: #905af0;
}

input:checked + .slider .switch-text.left {
  color: #905af0;
}

input:checked + .slider .switch-text.right {
  color: #fff;
}

/* 分页器样式 */
.pagination-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pagination-btn {
  padding: 8px 12px;
  background-color: #f8f5ff;
  color: #905af0;
  border: 1px solid #905af0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.pagination-btn:hover {
  background-color: #e6d9ff;
}

.pagination-btn:disabled {
  background-color: #f5f5f5;
  color: #ccc;
  border-color: #ddd;
  cursor: not-allowed;
}

.pagination-btn svg {
  display: inline-block;
  vertical-align: middle;
}

.pagination-btn:disabled svg {
  color: #ccc;
}

.pagination-btn.active {
  background-color: #905af0;
  color: white;
}

.page-numbers {
  display: flex;
  gap: 2px;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.page-jump input {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
}

.page-info {
  font-size: 14px;
  color: #666;
}



table {
  width: 100%;
  border-collapse: collapse;
}

.checkbox-column {
  width: 40px;
  text-align: center;
}

.word-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.manage-mode .checkbox-column {
  display: table-cell;
}

.checkbox-column {
  display: none;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  white-space: pre-line;
}

/* 序号列样式 */
th:first-child,
td:first-child {
  width: 80px;
  text-align: center;
  font: normal 1rem 'Comic Sans MS','Lucida Sans Unicode',Arial,sans-serif;
}

/* 单词字体设置 */
td:nth-child(2) {
  font: bold 1.2rem 'JetBrains Mono', 'Courier New', monospace, sans-serif;
}

/* 读音不换行 */
th:nth-child(3),
td:nth-child(3) {
  white-space: nowrap;
}

/* 确保翻译列和例句列正确显示换行 */
td:nth-child(4) {
  white-space: nowrap;
}

td:nth-child(5) {
  white-space: pre-line;
  word-wrap: break-word;
}

th {
  background-color: #e6d9ff;
  color: #4a2c7a;
  font-weight: 600;
}

tr:hover {
  background-color: #f0ebff;
}

/* 隔行变色 */
tr:nth-child(even) {
  background-color: #f8f5ff;
}

tr:nth-child(even):hover {
  background-color: #f0ebff;
}

tbody tr td:last-of-type,
tbody tr td:last-of-type .actions {
  width: 140px;
}

.word-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.edit-btn, .delete-btn, .memorized-btn {
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 14px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.edit-btn, .delete-btn {
  border: none;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.action-icon {
  width: 14px;
  height: 14px;
}

.edit-btn {
  background: #905af0;
  color: white;
}

.edit-btn:hover {
  background: #7a4bd1;
}

.delete-btn {
  background: #e74c3c;
  color: white;
}

.delete-btn:hover {
  background: #c0392b;
}

.memorized-btn {
  background-color: #905af0;
}

.memorized-btn:hover {
  background-color: #7a4dd6;
}

.memorized-btn.unmemorized {
  background-color: #dc3545;
}

.memorized-btn.unmemorized:hover {
  background-color: #c82333;
}

.memorized {
  color: #c2c5c6;
}

/* 模态框样式 */
.modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
}

.close-btn:hover {
  color: #2c3e50;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  font-weight: 600;
  color: #2c3e50;
}

.word-form input, .word-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.word-form textarea {
  resize: vertical;
}

.pronunciation-hint {
  display: block;
  margin-top: 5px;
  color: #7f8c8d;
  font-size: 12px;
  font-style: italic;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form-actions button {
  border-radius: 4px;
}

.cancel-btn {
  background-color: #7f8c8d;
}

.cancel-btn:hover {
  background-color: #6c7a89;
}

/* 工具类 */
.hidden {
  display: none !important;
}

.empty-message {
  text-align: center;
  padding: 30px;
  color: #7f8c8d;
  font-size: 18px;
}

/* 响应式设计 */
/* 页脚样式 */
.footer {
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 30px 0;
  margin-top: 50px;
  color: #6c757d;
  font-size: 14px;
  position: relative;
  bottom: 0;
  width: 100%;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  text-align: center;
  line-height: 1.6;
}

.footer-content a {
  color: #6c757d;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-content a:hover {
  color: #495057;
  text-decoration: underline;
}

.footer-separator {
  margin: 0 15px;
  color: #adb5bd;
}

@media (max-width: 720px) {
  .search-box, .add-box {
    width: 100%;
  }
  
  th, td {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .word-actions {
    flex-direction: column;
    gap: 5px;
  }
  
  .edit-btn, .delete-btn, .memorized-btn {
    width: 100%;
    margin-bottom: 5px;
  }
  
  /* 在小屏幕上隐藏某些列 */
  table {
    display: block;
    overflow-x: auto;
  }
  
  /* 页脚响应式 */
  .footer {
    padding: 20px 0;
    margin-top: 40px;
  }
  
  .footer-separator {
    margin: 0 8px;
  }
}

/* 新单词行高亮动画 */
@keyframes newWordHighlight {
  0% {
    background-color: #e8f5e8;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  }
  50% {
    background-color: #c8e6c9;
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
  }
  100% {
    background-color: transparent;
    transform: scale(1);
    box-shadow: none;
  }
}

.new-word-highlight {
  animation: newWordHighlight 0.6s ease-out;
  transition: all 0.3s ease;
}

/* 卡片视图样式 */
.word-card-list {
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.word-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
}

.word-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.word-card.selected {
  border: 2px solid #667eea;
  background: #f8f9ff;
}

.word-card-number {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 12px;
  color: #999;
  font-weight: 500;
}

.word-card-checkbox {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
}

.word-card-checkbox.show {
  display: block;
}

.word-card-content {
  margin-top: 16px;
}

.word-card-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.word-card-word {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

.word-card-pronunciation {
  font-size: 14px;
  color: #7f8c8d;
  font-style: italic;
}

.word-card-translation {
  font-size: 16px;
  color: #34495e;
  margin-bottom: 12px;
  line-height: 1.5;
}

.word-card-example {
  font-size: 14px;
  color: #7f8c8d;
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-line;
  font-style: italic;
}

.word-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.word-card-actions .edit-btn,
.word-card-actions .delete-btn,
.word-card-actions .memorized-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

/* 分页器响应式 */
.pagination {
  flex-wrap: wrap;
  justify-content: center;
}

.page-numbers {
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .word-card-list {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
  }
  
  .word-card {
    padding: 12px;
  }
  
  .word-card-word {
    font-size: 20px;
  }
  
  .manage-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
}